<?php
/**
 *
* Copyright(c) 201x,
* All rights reserved.
*
* 功 能：分发工厂类
* @author cabing_2005@126.com
* @date 2014-8-13
* 版 本：1.0
 */
class DisposeFactory{
    const PREX_DISPOSE = "Dispose";
    const PREX_FORMAT = "LogFormat";

    /**
     * 处理日志
     *
     * @param unknown $params
     * @param string $type
     */
    public static function dispose($params,$type="mysql")
    {
        $type = ucwords($type);
        $formatName = $type.self::PREX_FORMAT;
        $className = $type.self::PREX_DISPOSE;
        try{
            $params = $formatName::format($params);
            $className::dispose($params);
        }catch(DisposeException $e){
            echo $e->getMessage();
        }

        echo "sucess";
    }

    /**
     * 格式化日志
     * @param unknown $params
     */
    public static function format($params)
    {
        return LogFormat::format($params);
    }
}
// 日志异常类
class DisposeException extends Exception{}